import { del, get, post, put } from '@/utils/request';

interface Model {
  id: number
  seriesId: number
  nameZh: string
  nameEn: string
  descriptionZh: string
  descriptionEn: string
  createdAt: string
  updateAt: string
}
interface Models {
  data: Model[]
  total: number
  page: number
  limit: number
}
export const getModels = (params: any) => {
  return get<Models>('/admin/models', params);
};

export const changeModels = (data: any) => {
  if(data.id) {
    return put(`/admin/models/${data.id}`, data);
  } else {
    return post('/admin/models', data);
  }
};

export const deleteModels = (id: string) => {
  return del(`/admin/models/${id}`);
};
